home *** CD-ROM | disk | FTP | other *** search
- • BASIC Editor. If you type “EDIT.” instead of just “EDIT”, it gets
- you back into the editor at the same place you left it. This can be very
- useful when editing long programs. It even seems to work if you load and
- save other programs in the interim as long as you get the original
- program back into memory. Also, you can say EDIT Fred and it will take
- you to the first occurrence of the word “Fred” in the file. So, with
- judicious use of REM statements, you can jump into the program at just
- the right place every time. If you want to find DEFPROCfred, EDIT fred
- will probably bring you to PROCfred rather than the definition itself,
- but REM !FRED above the top of the procedure would allow you to type
- EDIT !FRED (note, all uppercase, which is easier to type) to drop you
- straight to the desired place in the program.
- 1.10
- • Artisan — fast load and save. If you have typed in the Fastload/Save
- module from the March issue of Archive, *COPY FastRm onto the Artisan
- disk and then LOAD “ART3”, list line 270 and add *RMLOAD FastRm|M and
- then re-save it. Now LOAD “ART5” change line 2540 to OSCLI“FastLoad ”+f$
- and line 2620 to OSCLI”FastSave “+f$. Then re-save it. You now have a
- new and improved disc facility for Artisan.
- 1.10
- • 305, 310, 410 or 440? Following on from the hint in the May issue
- (page 7) itÕs all very well to know what the page size is, 8k or 32k,
- but to differentiate between a 305 and a 310 or between a 410 and a 440,
- you need to know how much memory is available. One way of doing this is
- to set up a local error trap and do a *Configure Spritesize 128. If the
- machine has 1 Mbyte or less it will generate a “Configure parameter too
- big” error. If it still generates an error when you use *Configure
- Spritesize 64 then the software knows it is running in a 305. We have
- not had chance to check this on a 305 or a 410, so please will someone
- let us know if it does not work.
- 1.10
- • System DeltaPlus. If you want to use two drives, issue the following
- two commands from the card index:
- 1.10
- *dir :1
- 1.10
- *set Delta$WPPrefix :0.$
- 1.10
- Then donÕt specify the drive number in the data file name.
- 1.10
- • View 3 & Viewstore 1.1. Various folk are still having problems with
- these. If so, try the following as suggested by Sean Kelly — thanks.
- 1.10
- Viewstore 1.1. Locations &ABE2, &ABE3 and &ABE4 should all be set to the
- value &EA.
- 1.10
- View 3. Set locations &A8D6, &A8D7 and &A8D8 to the value &EA. Also,
- there are four places where you get LDA#&82, JSR Osbyte (i.e. &A9, &82,
- &20, &F4, &FF). This is used to check for the second processor on the
- BBC. So to fool it, you have to change each of these to: LDX#&FF,
- LDY#&FF, NOP. You can either do this by poking &A2, &FF, &A0, &FF, &EA
- into each of the sets of locations: &8834 to &8838, &88D8 to &88DC,
- &895C to &8960 and &AF8D to &AF91. (I checked these locations against
- the B3.0 version in the Master 128Õs and it bore no resemblance to it.
- Apparently it refers to the A3.0 version. Ed.)
- 1.10
- • Improved sound. If you have the colour monitor that comes with the
- Archimedes, you can use the Audio Input at the back of the monitor (a
- phono socket) to take a signal from the Headphones output (3.5 mm stereo
- jack) from the Archimedes. Just use one of the channels or combine them
- with 100R resistors. (If youÕre not quite sure how to do this, weÕll try
- to give more details next month.) This give a much better sound and
- provides you with a volume control.
- 1.10
- Next two hints are from Peter KigginsÉ
- 1.10
- • When using a SWI from BASIC which either takes or returns a string,
- it is not necessary to use pointers to strings. The SYS command knows
- that a pointer has been returned by the SWI and copies the relevant text
- into the string. For example, instead of
- 1.10
- $TxtPtr%=Number$
- 1.10
- SYS“OS_ReadUnsigned”,FromBase%,TextPtr% TO ,,Decimal%
- 1.10
- you can use the more readable and easier
- 1.10
- SYS“OS_ReadUnsigned”,FromBase%,Number$ TO ,,Decimal%
- 1.10
- And to read the command line which started the program, all that’s
- required is
- 1.10
- SYS “OS_GetEnv” TO Command_line$
- 1.10
- • BASIC commands TWIN and TWINO can be used without Acorn’s (editor)
- TWIN. How? When TWIN is executed, BASIC first converts the current
- program from internal tokenised format to plain text format; then it
- calls TWIN with the location of the text as a command line string. So
- all that is required is a program called TWIN which reads the command
- line and saves the relevant chunk of memory:-
- 1.10
- 10 REM >twin
- 1.10
- 20 REM*** fails with very short pieces of text ***
- 1.10
- 30 SYS “OS_GetEnv” TO command_line$
- 1.10
- 40 posat%=INSTR(command_line$,“@”)
- 1.10
- 50 poscomma%=INSTR(command_line$,“,”,posat%)
- 1.10
- 60 possemic%=INSTR(command_line$,“;”,poscomma%)
- 1.10
- 70 start$=“&”+MID$(command_line$,posat%+1,poscomma%-(posat%+1))
- 1.10
- 80 finish$=“&”+MID$(command_line$,poscomma%+1,possemic%-(poscomma%+1))
- 1.10
- 90 INPUT“Enter file name: ” file$
- 1.10
- 100 OSCLI(“save ”+file$+“ ”+start$+“ ”+finish$)
- 1.10
- 110 OSCLI(“settype ”+file$+“ &FFF”)
- 1.10
- The point of all this is that the BASIC Editor can now be used to
- produce text files — for wordprocessing, compiling, etc.
- 1.10
- • Auto-Booting — some of the commercial auto-boot programs don’t take
- into account the filing system! This can be very annoying if you have a
- ROM podule and your system is set to start up in the RFS. The answer is
- (i) the software developers should produce proper auto-boot programs; or
- (ii) if you already have bought a program — put *CON.FILE.ADFS in auto-
- boot program!
- 1.10
- Hard Disc Auto-Booting — some readers are lucky enough to have hard
- discs. However, life with a hard disc is not all a bed of roses! Having
- copied your application programs to the hard disc, you run into problems
- with the auto-booting routines. Here is a one of many possible solu
- tions. Indeed this program could be used for those of us with floppies,
- who have more than one application on a disc.
- 1.10
- 10 REM >$.!BOOT
- 1.10
- 20 REM **************************
- 1.10
- 30 REM * Multiple Auto-Booting *
- 1.10
- 40 REM * written by Adrian Look *
- 1.10
- 50 REM * 22nd June 1988 *
- 1.10
- 60 REM **************************
- 1.10
- 70
- 1.10
- 80 SYS “OS_Byte”,161,16 TO ,,misc_flags
- 1.10
- 90 auto_boot=(misc_flags AND %10000)
- 1.10
- 100 file$=“boot”
- 1.10
- 110 file=OPENIN(file$):CLOSE #file
- 1.10
- 120 IF file=0 THEN PROCmenu
- 1.10
- 130 file=OPENIN(file$)
- 1.10
- 140 INPUT #file,boot$
- 1.10
- 150 CLOSE #file
- 1.10
- 160 IF auto_boot THEN OSCLI(“REMOVE ”+file$)
- 1.10
- 170 OSCLI(“RUN ”+file$)
- 1.10
- 180 END
- 1.10
- 190
- 1.10
- 200 DEFPROCmenu
- 1.10
- 210 REM **** your own code ****
- 1.10
- 220 REM
- 1.10
- 230 REM should exit with file$
- 1.10
- 240 REM containing the filename
- 1.10
- 250 REM of the program to be run.
- 1.10
- 260 REM
- 1.10
- 270 REM e.g. PRINT #file,filename$
- 1.10
- 280 ENDPROC
- 1.10
- The program checks whether a file (file$) is on the disk. If it is, then
- the program reads the filename contained in file$ and runs it! Other
- wise, the program should create file$ — as indicated.
- 1.10
- This method also allows you to write library programs which will: create
- file$ and then run the boot program. Thus by running these library files
- you can also initiate your application programs — without the need for a
- menu!
- 1.10
- • Quazer Fix. If you are using Quasar 1.40, here is a cheat, (for
- those who like such things!) which allows you to keep going a bit
- longer. Firstly, *LOAD QuazCode 9000 and then rename Quazcode as, say,
- OldCode. Now if you want to set the number of lives, you need to change
- location &3D058. It should currently contain 2, so to change the number
- of lives to, say 10, put ?&3D058=10. Now if you want to avoid being
- killed when you collide, change the contents of location &3D90B from &E2
- to &F2 by puting ?&3D90B=&F2. Finally, *SAVE QuazCode 9000 +36520.
- 1.10
- •Passwords if you want them. Quazer Passwords: 2 Lizards, 3 Spiders, 4
- Pedantic, 5 Analysis, 6 Larkin, 7 Company, 8 Manual,9 Trading
- 1.10
- Hoverbod passwords: 2 Minervas, 3 SirBarry, 4 ZotyBlob, 5 Flumpies, 6
- Squidgee, 7 Wobblies, 8 Posskett
- 1.10
-
- 1.10
- The following Hints & Tips were sent in by Mike Harrison (of Watford
- Digitiser fame). HeÕs also sent us various other bits of information
- which appear elsewhere in this issue and the next issue. Many thanks
- Mike.
- 1.10
- Writing modules
- 1.10
- (Ref. issue 5, page 45) SWIs in modules must always use the ‘X’ version
- of the SWI and, where appropriate, check for an error and exit,
- preserving the value of r0 returned by the SWI (i.e. don’t restore the
- old value of R0 if it had been saved). e.g.
- 1.10
- .a_module_routine
- 1.10
- STMFD R13!,{r0-2 ,14} \or however many registers you need to save
- 1.10
- SWI “XOS_SomethingOrOther”
- 1.10
- STRVS R0,[R13] \overwrite old r0 with error pointer
- 1.10
- LDMVSFD R13!,{r0-2 ,PC}
- 1.10
- \ the last 2 statements could alternatively have been :
- 1.10
- \
- 1.10
- \ ADDVS R13,R13,#4 : LDMVSFD R13!,{r1-2 ,PC}
- 1.10
- For short routines, or where several SWIs are used, the following is
- neater..
- 1.10
- .a_short_routine
- 1.10
- STMFD R13!,{r0-5 ,14}
- 1.10
- SWI “XOS_SomeSwi”
- 1.10
- SWIVC “XOS_SomethingElse”
- 1.10
- SWIVC “XOS_YetAnotherSwi”
- 1.10
- STRVS R0,[R13]
- 1.10
- LDMFD R13!,{r0-5 ,PC}
- 1.10
- In this example, all code after first SWI should be conditional on V
- clear, so if any SWI gives an error, the code will ‘drop through’ to the
- end.
- 1.10
- Remember that some SWIs may return errors you don’t expect — e.g.
- OS_WriteC could return an error when output is *Spooled, setting the
- screen mode could give ‘Bad Mode’ etc. — some thought is required to
- ensure that module code will be reliable in all environments.
- 1.10
- When setting up offsets in headers and command tables, it is much easier
- to specify them when using offset assembly (OPT 4/6/7) — set O% to the
- code buffer, and P% to 0. Offsets can then be included directly with
- EQUD (e.g. EQUD moduletitle). Warning — if you are still using Basic
- 1.00, there is a bug in ALIGN when using offset assembly. Version 1.02
- is OK.
- 1.10
- The following assembler macro is useful when building keyword tables in
- modules (it assumes the use of offset assembly, as described above):
- 1.10
- DEF FNcommand(I%,A$)
- 1.10
- [ OPTpass : EQUS A$ : EQUB0 :
- 1.10
- ALIGN
- 1.10
- EQUD EVAL(A$)
- 1.10
- EQUD I%
- 1.10
- EQUD EVAL(A$+“syntax”)
- 1.10
- EQUD EVAL(A$+“help”)
- 1.10
- ]:=pass
- 1.10
- OPT FNcommand(“NewCmd”,N) will create a table entry, using the labels
- .NewCmd .NewCmdhelp and .NewCmdsyntax (N is the information word).
- 1.10
- Note that ‘pass’ is the name of the pass variable — change this if you
- use a different name.
- 1.10
- Podule manager/Clock slowdown
- 1.10
- (Ref. issue 7, page 44) The problem here is that SWIs are passed to
- modules with interrupts disabled, so if the SWI takes a significant
- amount of time to complete, the clock will slow down (the mouse pointer
- will also become sluggish). I can’t see why the podule manager should
- need interrupts off, so it’s probably an unintended ‘feature’ — SWI code
- which takes time to execute SHOULD enable interrupts, unless they have
- to be off. (The digitiser module only runs with interrupts off when
- absolutely necessary!) When interrupts have been disabled for signifi
- cant amounts of time, the seconds count of the real-time clock gets out
- of step with the minutes, which then don’t roll over at 59 secs — this
- looks weird if you don’t know about it!
- 1.10
- System Devices
- 1.10
- (Ref. issue 6, page 41) There is a very interesting feature, which I
- haven’t seen documented, concerning device oriented filing systems. When
- you set the printer type using *FX5,n where n is greater than 2, the OS
- looks for a system variable called printertype$n — n being the value
- used for FX5. This variable holds the name of the output file or device
- to which printer output should be sent. The Econet module, NetPrint,
- uses this to set printer type 4 to “netprint:”. What happens is that
- when you do <ctrl-B>, a file is opened, with the name given in this
- system variable, and <ctrl-C> closes the file. While this would normally
- send output to a hardware device, it can also use the name of a normal
- file; e.g.
- 1.10
- *set printertype$5 outfile
- 1.10
- *fx5 5
- 1.10
- Will cause subsequent printer output to be written to the file “outfile”
- — handy for debugging, and for saving data to print on other machines.
- Note that this will only work if a program does VDU2, sends ALL its
- output, then does VDU3. If it keeps turning the printer on and off all
- the time with VDU2/3, only the last part of the output will be in the
- file, as VDU2 re-opens the file, discarding its previous contents.
- (Econet users know only too well the problems caused by software not
- handling the printer correctly!)
- 1.10
- Just for fun, try :
- 1.10
- *set printertype$5 vdu:
- 1.10
- *fx5 5
- 1.10
- <Ctrl-B>
- 1.10
- All vdu output will appear ttwwiiccee!! — once via the normal route, and
- again via the printer stream.
- 1.10
- Use of SYS
- 1.10
- (Ref. issue 9, page 47) The following is a bomb-proof version of OSCLI
- in BASIC, which will report errors without entering BASICs error handler
- (it can also be used for other SWIs — e.g. OS_File to trap filing errors
- neatly)
- 1.10
- DEFPROCoscli(OS$)
- 1.10
- LOCAL flag%,error%
- 1.10
- SYS“XOS_CLI”,OS$ TO error% ; flag%
- 1.10
- IF flag% AND 1 THEN P.“Error : ”;:SYS“OS_Write0”,error%+4
- 1.10
- REM the error number can be read using !error%
- 1.10
- ENDPROC
- 1.10
- It works by reading back the V flag and error pointer returned by the X
- version of the SWI
- 1.10
- TWIN
- 1.10
- (Ref. issue 7, page 7) You can warm start Twin using *Twin -warm, using
- the same version of Twin, of course — *GO may cause problems if the code
- has been corrupted, (or you’ve forgotten the address!). There is a bug
- in all the versions of Twin I’ve seen (I’m not sure what version has
- been released), which means that when exiting from TWIN to BASIC, the
- event vector is messed up, so if you overwrite the address where Twin
- was run, and enable events, the machine crashes. This can be avoided by
- doing QUIT, *BASIC, and OLD.
- 1.10
- In one issue, there was a tip for entering ARMBE automatically at the
- line in error — here’s a similar routine if you prefer using TWIN to
- edit BASIC programs — It uses the TWINO8 option to strip line numbers
- (which you don’t need to use, DO YOU!!). If the error wasn’t Escape,
- pressing <Y> will enter TWIN at the line where the error occurred. Note
- that it assumes lines are numbered in 10s — this will be the case if the
- program has been edited in TWIN without line numbers, but not if lines
- have been inserted/deleted from the BASIC prompt — in this case, enter
- TWIN, and exit again, or do RENUMBER.
- 1.10
- ON ERROR PROCERR
- 1.10
- ...
- 1.10
- ...
- 1.10
- DEFPROCERR
- 1.10
- REPORT:PRINT“ at line ”ERL
- 1.10
- IF ERR=17 END
- 1.10
- PRINT“EDIT ?”:IF GET$=“Y” ELSE END
- 1.10
- *FX138 0 129
- 1.10
- *FX138 0 128
- 1.10
- FORA%=1 TO LEN(STR$(ERL DIV10))
- 1.10
- SYS 6,138,,ASC(MID$(STR$(ERL DIV10),A%,1))
- 1.10
- NEXT:*FX138 0 13
- 1.10
- END
- 1.10
- Hidden software
- 1.10
- (Ref. issue 9, page 4) Take a close look at the digitiser module!
- 1.10
-